//import Point;

/**
 * 
 */

class Line{
	/**
	 * 
	 */
	private final rgbEditor rgbEditor;
	public Point pA;
	public Point pB;
	public int type;
	public int index;//Position in myLines arraylist
	public int color;
	
	//Strut variables
	public float breakDist;	

	public Line(rgbEditor rgbEditor, Point _pA,Point _pB,int _type){
		this.rgbEditor = rgbEditor;
		pA=_pA;pB=_pB;type=_type;
		index = -1;
	}

	public void draw(){
		setDrawingMode();
		this.rgbEditor.drawLine(pA.pos.x,pA.pos.y,pB.pos.x,pB.pos.y);
	}

	public String toString(){
		//[eric] altered so that it prints out formatted as a wall
		//for use in level specification
		String retString;
		if (type == rgbEditor.WALL){
			retString = "wallBegin\nwallPoint,"+pA.toString()+"\nwallPoint,"+pB.toString()+"\nwallEnd";
		} else if (type == rgbEditor.ICEWALL){
			retString = "iceWallBegin\niceWallPoint,"+pA.toString()+"\niceWallPoint,"+pB.toString()+"\niceWallEnd";
		} else if (type == rgbEditor.DEATHWALL){
			retString = "deathWallBegin\ndeathWallPoint,"+pA.toString()+"\ndeathWallPoint,"+pB.toString()+"\ndeathWallEnd";
		} else if (type == rgbEditor.STICKYWALL){
			retString = "stickyWallBegin\nstickyWallPoint,"+pA.toString()+"\nstickyWallPoint,"+pB.toString()+"\nstickyWallEnd";
		}
		else{ retString = pA.toString()+", "+pB.toString();}
		return retString;
	}
	private void setDrawingMode(){
		//Change line style here if needed
		if (color == rgbEditor.RED) this.rgbEditor.stroke(255,0,0);
		else if (color == rgbEditor.GREEN) this.rgbEditor.stroke(0,255,0);
		else if (color == rgbEditor.BLUE) this.rgbEditor.stroke(0,0,255);
		else if (color == rgbEditor.INVISIBLE) this.rgbEditor.stroke(255,255,255,30);
		else this.rgbEditor.stroke(255,255,255);
		if (type==rgbEditor.SOLIDSTRUT) this.rgbEditor.stroke(200,200,200);
		else if (type==rgbEditor.ICEWALL) this.rgbEditor.stroke(0,0,255);
		else if (type==rgbEditor.DEATHWALL) this.rgbEditor.stroke(150,20,20);
		else if (type==rgbEditor.STICKYWALL) this.rgbEditor.stroke(150,255,150);
	}

}